package org.cigo.timemachine;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

import android.content.Intent;
import android.os.Bundle;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;

public class Main extends MapActivity  {
    
	private MapView mMapView;
	private SeekBar mSeekbar;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        mMapView = (MapView)findViewById(R.id.mapView);
        mMapView.setBuiltInZoomControls(true);
        
        mSeekbar = (SeekBar)findViewById(R.id.seekBar1);
        mSeekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
			
			public void onStopTrackingTouch(SeekBar seekBar) {
				// TODO Auto-generated method stub
				if(seekBar.getProgress() > 75){
					Intent itent = new Intent();
					itent.setClass(Main.this, Activity2.class );
					Bundle bl = new Bundle();
					bl.putInt("title", seekBar.getProgress());
					itent.putExtras(bl);
					startActivityForResult(itent, 0);
				}
				seekBar.setProgress(0);
			}
			
			public void onStartTrackingTouch(SeekBar seekBar) {
				// TODO Auto-generated method stub
				
			}
			
			public void onProgressChanged(SeekBar seekBar, int progress,
					boolean fromUser) {
				// TODO Auto-generated method stub
				
			}
		});
    }

	@Override
	protected boolean isRouteDisplayed() {
		return false;
	}
	
	protected void onActivityResult(int requestCode, int resultCode, Intent data){
		switch (resultCode) {
		case RESULT_OK:
			if(mSeekbar != null){
				mSeekbar.setProgress(0);
			}
			break;

		default:
			break;
		}		
	}
    
}